package com.thj.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

import com.dao.BaseDao;
import com.thj.dao.MenuDao;
import com.thj.dao.RoleMenuDao;
import com.thj.po.MenuPo;
import com.thj.po.RoleMenuPo;

public class RoleMenuDaoImpl implements RoleMenuDao {

	@Override
	public List<MenuPo> findMenuByRole(Integer RoleId) {
		MenuDao menuDao = new MenuDaoImpl();
		BaseDao baseDao = new BaseDao();
		List<MenuPo> list = new ArrayList();
		List<RoleMenuPo> list1 = new ArrayList();
		String sql = " select * from role_menu where role_id=?";
		list1 = baseDao.executeQuery(sql, null, RoleMenuPo.class, RoleId);
		for(RoleMenuPo i: list1){
			
			list.add(menuDao.findbyId(i.getMenuId()));
		}
		return list;
	}
	
	@Test
	public void test01(){
		this.findMenuByRole(30);
	}
}









